package com.sdk.es.http.gen.check;

import cn.hutool.core.util.ReflectUtil;
import com.sdk.es.sdk.entity.base.Test1;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * @author limaosheng
 * @create 2024-03-15 15:50
 * @desc
 */
public class checkEntiy {
    public static void main(String[] args) {
        Test1 old = new Test1();
        Field[] f1 = ReflectUtil.getFields(old.getClass());

        Test1 cur = new Test1();
        Field[] f2 = ReflectUtil.getFields(cur.getClass());

        List<String> oldList = new ArrayList<>();
        for(Field field1 : f1){
            oldList.add(field1.getName());
        }
        List<String> creList = new ArrayList<>();

        for(Field field : f2){
            creList.add(field.getName());
        }

        for(String s : oldList){
            if(!creList.contains(s)){
                System.out.println("旧有新没有：" + s);
            }
        }

        for(String s : creList){
            if(!oldList.contains(s)){
                System.out.println("新有旧没有：" + s);
            }
        }
    }
}
